const {User,Book} = require(rootDir+'/model');

exports.get = async function(ctx,next){
  const user = await User.findOne({uid:123});
  ctx.body = user;
  await next();
}

exports.post = async (ctx,next)=>{
  const request = ctx.request;
  const body = request.body;
  const {uid,name} = body;
  console.log(uid,name);
  try{
    await new Book({
      bid:1,
      bookname:'2'
    }).save();

  }catch(err){

    console.log('err');
  }


  ctx.body = {ok:true};
  await next();
};
